<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>a页面</title>
</head>
<body>
    用户输入内容 转递给b页面渲染
    <input type="text" placeholder="输入用户名" class="uname">
    <input type="text" placeholder="输入密码" class="pwd">
    <input type="radio" value="1" id="male" name="sex" >
    <label for="male">男</label>
    <input type="radio" value="0" id="female" name="sex"> 
    <label for="female">女</label>
    <input type="text" name="请输入金额" id="money">
    <textarea name="" id="long" cols="30" rows="10"></textarea>
    <button>发送给b页面</button>
    <script>
        let uname = document.querySelector('.uname')
        let pwd = document.querySelector('.pwd')
        let money = document.querySelector('#money')
        let long = document.querySelector('#long')
        let btn = document.querySelector('button')
        let radioList = document.querySelectorAll('input[type="radio"]')
        let val;
        //给按钮添加点击事件，通过loction去传递参数
        //传递上面所有的value值得=》如何获取表单节点value值
        btn.addEventListener('click',function(){
            // 获取当前时间戳
            let timeStramp = new Date().getTime()
            //1.获取对应的value值
            console.log(uname.value,pwd.value)
            console.log(money.value,long.value)
        //    console.log(val)
           radioList.forEach(function(ele,index){
                // ele 单选框的节点 对应的下标
                //  男 checked true  女checked false
                if(ele.checked){
                    //选中的节点
                    console.log(ele.value)
                     val = ele.value
                }

             })
            //2.通过location对象跳转页面并传递参数
            location.href = `b.html?uname=${uname.value}&pwd=${pwd.value}&sex=${val}&money=${money.value}&long=${long.value}&timeStramp=${timeStramp}`
        })
       

    </script>
</body>
</html>